package org.apache.lucene.search;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.solr.search.SolrIndexSearcher.QueryCommand;

/**
 * 检索打分算法。 综合考虑相关度和热度因素。
 * 
 */
public class PageScorer extends CScorer {

	private static final Log log = LogFactory.getLog(PageScorer.class);
	
	private QueryCommand cmd;

	public PageScorer(QueryCommand cmd) {
		this.cmd = cmd;

		this.fields = new SortField[] { new SortField("scorer", SortField.Type.FLOAT)};
	}

	@Override
	protected float calculateBusinessScorer(Comparable[] values) {
		return Float.valueOf(values[0].toString());
	}

	@Override
	protected float calculateTotalScorer(float maxScore, float luceneScore,
			float businessScore) {
		return luceneScore / maxScore * 10 + businessScore;
	}
}
